Repository navigation
fix(admin): redact the secrets inside a container-valued settings write - #1350
Conversation
(cherry picked from commit 21d335e)
🦋 Changeset detectedLatest commit: 5b223bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no actionable issues were found.
|
A settings write whose path is a container redacts that container's secrets in the response echo and in the
settings.changedoutbox row, instead of returning and publishing them raw. Closes #1193.Cherry-picked from saket0187/nostream#6 with
-x, by @saket0187, so authorship and the changeset stay theirs.What it fixes
PATCH /admin/settingsredacted a written value only when the exact path was a secret. Writing a parent path (admin.notifications) echoed every target'surlandbotTokenback in the response and queued them insettings.changed, which is delivered to the notification channel and stored.The change walks the written value from the write path, using the same classification
settings_getalready applies, so a nested secret is redacted by where it sits rather than by the path that named it. It also fixes two misses in the walker itself: a path padded with whitespace (parse_pathtrims it on write, the classifier did not) and asecret[label]suffix whose bracket was stripped even when the label was not numeric.Testing
Against
ead3997e(the fork's base), the new tests fail: 4 of 12 innostream-config, and the end-to-end case innostream-admin.On this branch, from
e5a78d70:cargo test -p nostream-config --test redactioncargo test -p nostream-admin --test write_pathcargo test -p nostream-mcp --test tool_payloadsThe admin and MCP suites need
TESTCONTAINERS_RYUK_DISABLED=truein a sandbox without the reaper.A write-protected path with padding (
admin.passwordHash) is still refused, by the schema check rather than the guard;is_write_protected_settings_pathcompares the raw path and could normalize too, but this change does not touch it.